home *** CD-ROM | disk | FTP | other *** search
- /*
- File: UseRsrcM.h
-
- Contains: Functions for using resources from the resource fork of a library
-
- Owned by: Reggie Adkins
-
- Copyright: © 1996 by Apple Computer, Inc., all rights reserved.
-
- Theory of Operation:
-
- This utility provides convenient access to a part editor's (or other shared
- library's) resources -- a library's resource fork is _not_ by default open
- or accessible. Please see the OpenDoc tech note "Using Resources" for full
- instructions.
-
- Change History (most recent first):
-
- <3> 10/22/96 DH 1369514 Overhauled resource loading
- functions so that a variety of places can
- be searched for resources to load into temp
- mem.
- <2> 6/21/96 DH 1353507: 1.0.x: Dragging Scrapbook OpenDoc
- clipping to document can cause crash. Added
- function to read a resource fork that takes
- a fileRefNum
- To Do:
- */
-
-
- #ifndef _USERSRCM_
- #define _USERSRCM_
-
- #ifndef _ODTYPES_
- #include "ODTypes.h"
- #endif
-
- #ifndef _EXCEPT_
- #include "Except.h"
- #endif
-
- #ifndef __CODEFRAGMENTS__
- #include <CodeFragments.h>
- #endif
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
-
- OSErr InitLibraryResources( CFragInitBlockPtr );
-
- void CloseLibraryResources( );
-
-
- ODSLong BeginUsingLibraryResources( );
- void EndUsingLibraryResources( ODSLong );
-
-
- ODHandle ODReadResource( ResType type, short id );
- ODHandle ODReadNamedResource( ResType type, ConstStr255Param name );
-
- ODPtr ODReadResourceToPtr( ResType type, short id );
- ODPtr ODReadNamedResourceToPtr( ResType type, ConstStr255Param name );
-
- void ODGetString( Str255 str, short id );
- void ODGetIndString( Str255 str, short id, short index );
-
- void* ODReadResourceUsingRefnum( short ResRefNum, ResType type, short id,
- ConstStr255Param name, ODBoolean asHandle );
- void* ReadResourceIntoTempMem( ResType type, short id, ConstStr255Param name,
- ODBoolean asHandle );
- void* ReadIndexedResourceIntoTempMem( ResType type, short index, ODBoolean asHandle );
-
- #ifdef __cplusplus
- } // ends extern "C"
-
- class CUsingLibraryResources :private Destructo {
- public:
- CUsingLibraryResources( ) {fRefNum=BeginUsingLibraryResources();}
- ~CUsingLibraryResources( );
- private:
- ODSLong fRefNum;
- };
-
- inline void BeginUsingLibraryResources( ODSLong &ref ) // param is for backward compatibility
- {ref=BeginUsingLibraryResources();}
- #endif
-
-
- #endif /* _USERSRCM_ */